$(document).ready(function(){
	$('#search_button').click(function() {
		var service_id = $('select.service_id').val();
		var user_id = $('select.user_id').val();
		$.get('/domain/bind_search', {'user_id':user_id, 'service_id':service_id}, function(data){
			$('#search_result').html(data);
			$('a.bind').colorbox({iframe:true,width:"30%", height:"30%" });
			$('a.unbind').colorbox({iframe:true,width:"30%", height:"30%" });
			function cb(index, jq) {
				$.get('/domain/unit_search', {'user_id':user_id, 'service_id':service_id, 'page':index}, function(data){
					$('#bind_result').html(data);
					$('a.bind').colorbox({iframe:true,width:"30%", height:"30%" });
					$('a.unbind').colorbox({iframe:true,width:"30%", height:"30%" });
				});
			}
			$('#links').pagination(total, {'callback':cb, 'items_per_page':10, 'num_display_entries':5});
		},'html')
	});


});
